import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllMiniapps = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        miniappsLoading: false,
        miniapps: [],
    });

    const loadAllMiniapps = async () => {
        state.miniappsLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let miniapps = res?.a?.nodes || [];
        let miniapps = [0, 1, 3, 3, 3, 3, 3]
        state.miniapps = miniapps;
        state.miniappsLoading = false;
        // return Miniapps;
    };

    return { ...state, loadAllMiniapps };
};


const query = compress(``);

export default useAllMiniapps;
